---
layout: commands
page_title: 'Commands: Services Deregister'
description: |
  The `consul services deregister` command removes a service from the Consul catalog. Run the command on the agent that initially registered the service.
---

# Consul Agent Service Deregistration

Command: `consul services deregister`

Corresponding HTTP API Endpoint: [\[PUT\] /v1/agent/service/deregister/:service_id](/consul/api-docs/agent/service#deregister-service)

The `services deregister` command deregisters a service with the local agent.
Note that this command can only deregister services that were registered
with the agent specified and is intended to be paired with `services register`.
By default, the command deregisters services on the local agent.

We recommend deregistering services registered with a configuration file by deleting the file and [reloading](/consul/commands/reload) Consul. Refer to [Services Overview](/consul/docs/services/services) for additional information about services.

The following table shows the [ACLs](/consul/api-docs/api-structure#authentication) required to run the `consul services deregister` command:

| ACL Required    |
| --------------- |
| `service:write` |

You cannot use the Consul command line to configure [blocking queries](/consul/api-docs/features/blocking) and [agent caching](/consul/api-docs/features/caching), you can configure them from the corresponding HTTP endpoint.

## Usage

Usage: `consul services deregister [options] [FILE...]`

This command can deregister either a single service using the `-id` flag
documented below, or one or more services using service definition files
in HCL or JSON format.
This flexibility makes it easy to pair the command with the
`services register` command since the argument syntax is the same.

#### Command Options

- `-id` - Specifies the ID of a service instance to deregister.
  Do not use this flag if any FILE arguments are given.

#### Enterprise Options

@include 'cli-http-api-partition-options.mdx'

@include 'http_api_namespace_options.mdx'

#### API Options

@include 'http_api_options_client.mdx'

## Examples

To deregister by ID:

```shell-session
$ consul services deregister -id=web
```

To deregister from a configuration file:

```shell-session
$ cat web.json
{
  "Service": {
    "Name": "web"
  }
}

$ consul services deregister web.json
```
